package com.shd.day04;

import java.util.Arrays;
import java.util.Optional;
import java.util.stream.Stream;

/**
 * @author S5343
 * @date 2018年7月23日下午9:46:05
 */
public class StreamFind {
	public static void main(String[] args) {
		Stream<Integer> stream1 = Arrays.stream(new Integer[] { -11, 10, 34, 5, 6 });
		Optional<Integer> findAny1 = stream1.filter(i -> i > 0).findAny();

		System.out.println(findAny1.get());

		Stream<Integer> stream2 = Arrays.stream(new Integer[] { -11, 2, 34, 5, 6 });
		Optional<Integer> findAny2 = stream2.filter(i -> i > 0).findFirst();
		System.out.println(findAny2.get());

	}
}
